package com.zixuan.sina.config.rabbitmq;


import com.rabbitmq.client.AMQP;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;



//@Configuration
public class RabbitMqConfig {
    private static String EXCHANGE_NAME="my_change";
    private static String QUEUE_NAME="my_queue";
    private static String CONFIRM_QUEUE_NAME="my_confirm_queue_name";

    /**
     * 声明交换机
     * @return
     */
//    @Bean("directChange")
    public DirectChange exchange() {
        return new DirectChange(EXCHANGE_NAME, QUEUE_NAME);
    }




//    @Bean
    public MessageConverter messageConverter() {
        Jackson2JsonMessageConverter jackson2JsonMessageConverter = new Jackson2JsonMessageConverter();
        jackson2JsonMessageConverter.setCreateMessageIds(true);
        return jackson2JsonMessageConverter;
    }
}
